package com.java.yihur.stimulateduck.advancedduck;


import com.java.yihur.stimulateduck.advancedduck.ducks.BaseDuck;
import com.java.yihur.stimulateduck.advancedduck.ducks.GreenHeadBaseDuck;
import com.java.yihur.stimulateduck.advancedduck.ducks.RedHeadBaseDuck;
import com.java.yihur.stimulateduck.advancedduck.ducks.StoneBaseDuck;
import com.java.yihur.stimulateduck.advancedduck.flybehavior.NoFlyBehavior;
import com.java.yihur.stimulateduck.advancedduck.quackbehavior.NoQuackBehavior;

/**
 * @author Administrator
 */
public class StimulateDuck {

    public static void main(String[] args) {

        BaseDuck mGreenHeadBaseDuck = new GreenHeadBaseDuck();
        BaseDuck mRedHeadBaseDuck = new RedHeadBaseDuck();
        BaseDuck stoneBaseDuck = new StoneBaseDuck();

        mGreenHeadBaseDuck.display();
        mGreenHeadBaseDuck.fly();
        mGreenHeadBaseDuck.quack();
        mGreenHeadBaseDuck.swim();

        mRedHeadBaseDuck.display();
        mRedHeadBaseDuck.fly();
        mRedHeadBaseDuck.quack();
        mRedHeadBaseDuck.swim();
        System.out.println("==修改红头鸭属性==");
        mRedHeadBaseDuck.display();
        mRedHeadBaseDuck.setFlyBehavior(new NoFlyBehavior());
        mRedHeadBaseDuck.fly();
        mRedHeadBaseDuck.setQuackBehavior(new NoQuackBehavior());
        mRedHeadBaseDuck.quack();

        stoneBaseDuck.display();
        stoneBaseDuck.fly();
        stoneBaseDuck.quack();
    }

}
